<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="socketclient.js"></script>
</head>

<body>

<div id="list">

</div>

<input id="content" type="text" />
<input id="send" type="button" value="发送" />
<script>

var client = new SocketClient("127.0.0.1",8181,"chat");
client.connect();

client.onData  = function(text) {
    var div = document.createElement('div');
    div.innerHTML = text;
    document.getElementById('list').appendChild(div);
}

document.getElementById('send').onclick = function(e){
    client.sendData(document.getElementById('content').value);
}

</script>
</body>
</html>


